A Fresh Look at Parametric Polymorphism: Covariant Types
نویسنده
چکیده
The covariant type system is rich enough to represent polymorphism on inductive types, such as lists and trees, and yet is simple enough to have a set-theoretic semantics. Its chief novelty is to replace function types by transformation types, which denote parametric functions. Their free type variables are all in positive positions, and so can be modelled by covariant functors. Similarly, terms denote natural transformations. There is a translation from the covariant type system to system F which preserves non-trivial reductions. Consequently, covariant reduction is strongly normalising and connuent.
منابع مشابه
Parametric Types in Java { A Look At GenericJava
Sun is currently evaluating a number of proposals for adding parametric types to the Java programming language. This paper presents some experiences with types and type safety in the context of C, C++, and Java, and provides some opinions on GenericJava, the leading proposal for parametric types in Java.
متن کاملOn Variance-Based Subtyping for Parametric Types
We develop the mechanism of variant parametric types, inspired by structural virtual types by Thorup and Torgersen, as a means to enhance synergy between parametric and inclusive polymorphism in object-oriented languages. Variant parametric types are used to control both subtyping between different instantiations of one generic class and the visibility of their fields and methods. On one hand, ...
متن کاملAn Interval-Based Inference of Variant Parametric Types
Variant parametric types represent the successful integration of subtype and parametric polymorphism to support a more flexible subtyping for Javalike languages. A key feature that helps strengthen this integration is the use-site variance. Depending on how the fields are used, each variance denotes a covariant, a contravariant, an invariant or a bivariant subtyping. By annotating variance prop...
متن کاملMechanisms for improved covariant type-checking
Covariant types are a powerful language feature for improving type-safety. However, covariant types complicate type-checking when combined with polymorphism. We propose two new language features that can improve type-checking in a language with polymorphism and covariant typing, and also have the potential to improve efficiency as well. Published by Elsevier Ltd.
متن کاملCovariance and Contravariance: a fresh look at an old issue
Twenty years ago, in an article titled “Covariance and contravariance: conflict without a cause”, I argued that covariant and contravariant specialization of method parameters in object-oriented programming had different purposes and deduced that, not only they could, but actually they should both coexist in the same language. In this work I reexamine the result of that article in the light of ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1996